<template>
    <van-nav-bar
      :title="title"
      left-text="返回"
      left-arrow
      border
      @click-left="onClickLeft"
    />
</template>

<script>
  import Vue from 'vue'
  import { NavBar  } from 'vant';

  Vue.use(NavBar)
  export default {
    name: 'Head',
    data() {
        return {
            title: "",
            url:"/person"
        }
    },
    methods: {
        setNavBarUrl(url, title='') {
          if(url != undefined && url != ''){
              this.url = url
          }
          if(title == ''){
              this.title = this.$route.meta.title
          }else{
              this.title = title
          }

          console.log(this.url)
          console.log(this.$route.meta.title)
        },
        onClickLeft() {
            this.$router.push({path: this.url})
        }
    },
    mounted() {
        this.$nextTick(() => {
          this.$emit('eventGetHeadHeight', this.$el.offsetHeight)
        })
    }
  }
</script>

<style>
</style>
